home *** CD-ROM | disk | FTP | other *** search
- /*
- ** CTerminalPane.h
- **
- ** Eric’s standard libraries
- ** Terminal display pane
- **
- ** Copyright © 1993, FrostByte Design / Eric Scouten
- ** Portions copyright © 1990 Symantec Corporation. All rights reserved.
- */
-
-
- #pragma once
- #include <CPanorama.h>
-
- /*
- ** This class provides a rudimentary terminal emulator. It’s nothing
- ** fancy or snazzy. It doesn’t do VT100; it doesn’t do scrollback;
- ** it doesn’t handle any kind of formatting. (NCSA won’t be jealous,
- ** in other words.)
- */
-
- /*
- ** These constants define the terminal size. You may change them here. With a little
- ** work, these parameters could be changed on the fly. But I haven’t been so ambitious. :-P
- */
-
- #define maxX 80 /* width of screen */
- #define maxY 24 /* height of screen */
-
- #define pixelsX 6 /* default font char width (Monaco 9) */
- #define pixelsY 11 /* default font char height */
-
- #define offsetX 4 /* horizontal offset from screen edge */
- #define offsetY 4 /* vertical offset from screen edge */
-
- #define sizeX 488 /* 80 columns * 6 pixels + 8 margin */
- #define sizeY 272 /* 24 rows * 11 pixels + 8 margin */
-
- // define the characters we will recognize
-
- #define charNUL 0 /* Telnet standard keycodes */
- #define charBEL 7
- #define charBS 8
- #define charHT 9
- #define charLF 10
- #define charVT 11
- #define charFF 12
- #define charCR 13
- #define charDEL 127
-
-
- // class definition
-
-
- class CTerminalPane : public CPanorama {
-
- protected:
- char theScreen[maxY][maxX]; /* contents of the screen */
- short theColumn; /* terminal cursor column number */
- short theLine; /* terminal cursor line number */
- Boolean blinkCursor; /* cursor blinking is enabled */
- Boolean cursorVis; /* cursor is inverted */
- short lastCursorCol; /* position of displayed cursor */
- short lastCursorLine;
- long lastCursorTick; /* time at last cursor flash */
-
-
- /* contruction/destruction */
-
- public:
- void ITerminalPane (CView *anEnclosure, CBureaucrat *aSupervisor,
- short aWidth, short aHeight, short aHEncl, short aVEncl,
- SizingOption aHSizing, SizingOption aVSizing);
-
- /* drawing */
-
- virtual void Draw (Rect *area);
-
- /* blinking cursor support */
-
- virtual void Dawdle (long *maxSleep);
- virtual Boolean BecomeGopher (Boolean fBecoming);
- virtual void SetBlinking (Boolean blinkMode);
-
- /* scrolling */
-
- virtual void ScrollToSelection (void);
-
- /* terminal emulation methods */
-
- virtual void DoClearScreen (void);
- virtual void DoWriteChar (char theChar);
- virtual void DoWriteStr (char *theStr);
- virtual void DoWriteBfr (char *theStr, short theSize);
- virtual void DoWriteCharNum (char theChar, char leftBracket, char rightBracket);
- virtual void DoEraseChar (void);
- virtual void DoEraseLine (void);
-
- /* private screen handling methods */
-
- protected:
- virtual void ClearToEOL (short col, short line);
- virtual void ClearToEOS (short col, short line);
- virtual void ScrollTerm (void);
- virtual void InvalCharRect (short left, short top,
- short right, short bottom);
- virtual void CursorMoved (void);
- virtual void CalcCharRect (short left, short top, short right,
- short bottom, LongRect *theRect);
- virtual void InvertCursor (short col, short line);
-
- };
-